﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace GeostatisticalTool.Classes
{
    public class FitModel
    {
       // private SpatialContinuity spatial;
        private IKrigingModel model;

        public IKrigingModel SetTheoreticalModel
        {
          get { return model; }
          set { model = value; }
        }


        public FitModel(SpatialContinuity spatial, Model initialModel)
        {
            this.model = SelectModel(initialModel);
            this.model.C0 = 0;
            this.model.C1 = spatial.SemivarianceStatistic.Max;
            this.model.Range = spatial.NumberOfLags * spatial.LagSize / 3;
        }


        private IKrigingModel SelectModel(Model value)
        { 
            IKrigingModel model;
            switch (value)
            {
                case Model.Circular:
                     model = new ModelCircular();
                    break;
                case Model.Exponential:
                    model= new ModelExponential();
                    break;
                case Model.Gaussian:
                    model= new ModelGaussian();
                    break;
                case Model.Linear:
                    model = new ModelLineal();
                    break;
                case Model.Spherical:
                    model= new ModelSpherical();
                    break;
                default:
                    model= new ModelExponential();
                    break;
            }
            return model;


        }

        public IKrigingModel BestParameterModel()
        {
            return model;
        
        }
    }



}
